<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <title>登记-安平县居民核酸检测信息系统</title>
  <meta name="renderer" content="webkit">
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
  <link rel="stylesheet" href="layui/css/layui.css"  media="all">
  <link rel="stylesheet" href="lay.css"  media="all">
  <script src="https://cdn.bootcdn.net/ajax/libs/fastclick/1.0.6/fastclick.js"></script>
  <script src="jquery.min.js"></script>
  <script src="jquery.cookie.js"></script>
  <script src="fn.js?v=2"></script>
</head>
  <style>
    #main{
        width: 340px;
        margin: 0 auto;
        margin-top: 30px;
        margin-bottom: 15px;
    }
    #main dl{
        
    }
    #main dl dd{
        width: 340px;
    }
    #main dl dt{
        display: flex;
        justify-content: left;
        align-items: center;
        height: 34px;
    }
    #main dl dt span{
        color: red;
        position: relative;
        top: 3px;
        margin-right: 5px;
    }
    .tips{
          width: 340px;
          color: #999;
          margin: 0 auto;
    }
    .copy{
        text-align: center;
        width: 100%;
    }
    .layBox{
        min-height: 580px;
        overflow: hidden;
    }
    .button{
        width: 200px;
        position: relative;
        left: 50%;
        margin-left: -100px;
        margin-top: 30px;
    }
    .closeError{
    	position: absolute;
        width: 20px;
        height: 20px;
        overflow: hidden;
        right: 15px;
        top: 15px;
    }
    .closeError img{
    	width:100%;
    }
</style>
<body>
    <div id="black"></div>
    <div id="error">
      	<div class="closeError"><img src="images/close_icon.png" /></div>
        <div class="errorImg"><img src="error.png" width="180" height="140" /></div>
        <div class="errorTitle">失败，请选择人员入组！</div>
        <div class="errorBtn">
            <span onlick="Close()">点击关闭</span>
        </div>
    </div>
    <div class="layBox">
        <div id="main">
            <dl>
                <dt>
                    <span>*</span>
                    身份证号/证件号
                </dt>
                <dd>
                    <input type="text" class="layui-input" placeholder="请输入身份证号/证件号" id="idCard" /> 
                </dd>
            </dl>
        </div>
        <div class="button layui-btn" id="select">查询</div>
    </div>
    
    <div class="copy">
        <p>安平县新冠肺炎疫情防控工作指挥部</p>
        <p>技术支持：智慧安平</p>
    </div>

<script src="layui/layui.js" charset="utf-8"></script>
<!-- 注意：如果你直接复制所有代码到本地，上述js路径需要改成你本地的 -->
<script>
layui.use(['form', 'layer', 'jquery'], function(){
  var form = layui.form
  ,layer = layui.layer
  ,$ = layui.jquery;
})
var code = getUrlName('code');
if(code == null || code == "" || code == undefined){
    $("body").html("请在微信客户端打开链接")
}else{

    var btn = $("#select");
    btn.unbind("click");
    btn.click(function(){
     
        //Tanchuang("未查询到该人员信息", "添加人员信息", 2);
        $.ajax({
            url: "http://user.city1000.cn:9999/hesuan/api/queryUser?wxcode="+code+"&idCard="+$("#idCard").val().trim(),
            type: "GET",
            dataType: "json",
            data: {},
            success: function (res) {
                // 有用户
                if(res.code == 0){
                    layer.msg(res.msg);
                    //console.log(encodeURI(res.data.name));
                    $.cookie('name', res.data.name);
                    $.cookie('idCard', res.data.idCard);
                    $.cookie('phone', "");
                    $.cookie('userid', res.data.id);
                    setTimeout(function(){
                        $(location).attr("href", "http://user.city1000.cn:9999/weixin/wechat/h5/redirectSomeWhere?url=http://hesuan.city1000.cn/register_v2/user_sm.html");
                    }, 1000)

                }else if(res.code == 4005){
                	Tanchuang("系统检测到您原信息不完善", "点击重新注册", 2);
                }
                // 无用户
                else if(res.code == 4004){
                    Tanchuang("未查询到该人员信息", "新人员注册", 2);
                }else{
                    setTimeout(function(){
                        $(location).attr("href", "http://user.city1000.cn:9999/weixin/wechat/h5/redirectSomeWhere?url=http://hesuan.city1000.cn/register_v2/search_user.html");
                    }, 1000)
                }
                console.log(res)
            },error: function(err){
          		alert("服务器错误"+JSON.stringify(err))
              	console.log(err);
            }
        })
    })
}
</script>

</body>
</html>